<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02JS变量与常量</title>
</head>
<body>

<script>
    // 变量:变量是存储数据的容器,变量名必须以字母开头,不能以数字开头,不能包含特殊字符,变量名区分大小写
    var a = 10;
    var b = 3.14;
    var c = "hello";
    var d = '你好';
    var e = true;
    console.log(a, b, c, d, e);
    console.log(typeof a, typeof b, typeof c, typeof d, typeof e);
    var a = 'asdfasdfasdfasdfasdf';
    console.log(a, typeof a);
    // 被let修饰的变量,可以修改值及其类型,但是不能重复声明
    let f = 10;
    console.log(f, typeof f);
    f = false;
    console.log(f, typeof f);
    const g = 10;
    console.log(g, typeof g);
    // g = 123;// 报错:尝试分配给 const 或 readonly 变量
    // console.log(g, typeof g);
</script>
</body>
</html>